<?php

namespace App\Modules\Crowd;


use App\Modules\Crowd\Models\Crowd;
use App\Modules\Order\Models\SupportOrder;
use App\Modules\User\Models\User;

class Manager
{
    /**
     * @param User $user
     * @param Crowd $crowd
     * @param $money
     * @param $content
     * @return SupportOrder
     */
    public static function support(User $user, Crowd $crowd, $money, $content)
    {
        return SupportOrder::query()
            ->create([
                'pay_no' => SupportOrder::getNo(),
                'user_id' => $user->id,
                'crowd_id' => $crowd->id,
                'price' => $money,
                'status' => SupportOrder::STATUS_INIT,
                'content' => $content
            ]);
    }
}
